package com.mysoft.gfyx.marketdevelop.controller;

import com.mysoft.framework.rpc.annotation.PubAction;
import com.mysoft.framework.rpc.annotation.PubService;
import com.mysoft.framework.rpc.contants.RequestPrefix;
import com.mysoft.gfyx.common.rpc.bigdata.dto.GetNewHouseSaleListDto;
import com.mysoft.gfyx.marketdevelop.controller.dto.GetDetailDataRequestDto;
import com.mysoft.gfyx.marketdevelop.controller.dto.GetNewHouseSaleRequestDto;
import com.mysoft.gfyx.marketdevelop.service.DeveloperSaleProjectService;
import com.mysoft.gfyx.marketdevelop.service.NewHouseSaleService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;

@PubService(value = "/saleProjectApi", prefix = RequestPrefix.API)
@Tag(name = "在售项目数据-API")
public class SaleProjectApiController {
    @Autowired
    private DeveloperSaleProjectService developerSaleProjectService;

    @Autowired
    private NewHouseSaleService newHouseSaleService;

    @PubAction(value = "/detail", method = RequestMethod.POST)
    public Object projectDetail(@RequestBody GetDetailDataRequestDto dto) {
        return developerSaleProjectService.getProjectDetail(dto);
    }
    // 测试获取新房销售数据api
    @PubAction(value = "/new-house-sale-list", method = RequestMethod.POST)
    public Object newHouseSaleList(@RequestBody GetNewHouseSaleRequestDto dto) {
        GetNewHouseSaleListDto res = newHouseSaleService.getNewHouseSaleList(dto);
        if (res != null) {
            return res.getData();
        }
        return null;
    }
}
